package designmodel.builder.经典建造者模式;

/**
 *
 * @author scylla
 * @version V1.0
 * @project echo-java-base
 * @title
 * @package designmodel.builder.经典建造者模式
 * @since 2021/12/15 6:06 下午
 */
public class Director {


    public void makeComputer(ComputerBuilder builder) {
        //此处可以决定 组装顺序
        builder.display()
                .usbCount()
                .keyboard();
    }

    // 此处可以继续扩展其他的建造逻辑

    public static void main(String[] args) {
        Director director = new Director();
        ComputerBuilder macBuilder = new ConcretMacBuilder();
        director.makeComputer(macBuilder);
        Computer mac = macBuilder.getComputer();

        System.out.println(mac);

        ComputerBuilder lenovoBuilder = new ConcretLenovoBuilder();
        director.makeComputer(lenovoBuilder);
        Computer lenovo = lenovoBuilder.getComputer();


        System.out.println(lenovo);
    }

}
